################################################################################################

cluster=$1
config_path=$2

source ${config_path}/config.sh

clustern=`echo $cluster | awk -F"cluster" '{print $2}'`

################################################################################################

output_dir=${work_dir}/results/cluster_all_result
magic_dir=${output_dir}/cluster${clustern}/magic

echo "cluster${clustern} correlation start"
mkdir -p ${output_dir}/cluster${clustern}/correlation

${Rscript_magic} ${scripts_dir}/cluster_peak_correlation.R \
--cluster ${cluster} \
--magic ${output_dir}/cluster${clustern}/magic \
--output ${output_dir}/cluster${clustern}/correlation  \
2> ${log_path}/cluster_peak_correlation.${cluster}.log

# END! #
echo "cluster${clustern} finished"

